package com.twu.biblioteca;

import java.util.List;
import java.io.PrintStream;

/**
 * Created by balau on 3/5/14.
 * hallllooo
 */
public class Printer {

    PrintStream printStream;

    public Printer(PrintStream printStream) {
        this.printStream = printStream;
    }

    public void print(String string) {
        printStream.println(string);
    }

    public void printList(List<String> stringList) {
        String formattedList = formatStringListForDisplay(stringList);
        printStream.println(formattedList);
    }

    public String formatStringListForDisplay(List<String> bookNames) {
        String formattedList = "";

        for(int i = 0; i < bookNames.size(); i++) {
            formattedList = formattedList + "[" + (i + 1) + "] " + bookNames.get(i) + "\n";
        }

        return formattedList;
    }

}
